package com.swingson.properties.impl;

import com.swingson.SwingsonGui;
import com.swingson.jsonparser.JsonElement;
import com.swingson.properties.AnchoredPropertyProcessor;
import javax.swing.JComponent;
import net.miginfocom.swing.MigLayout;

/**
 * @author sad
 */
public class MigLayoutConstraintsPropertyProcessor extends AnchoredPropertyProcessor {

    @Override
    protected Object getValue(JsonElement jsonElement, JComponent component, SwingsonGui gui, String propertyName) {
        String value = jsonElement.getAsString();
        MigLayout layout = (MigLayout) component.getLayout();
        layout.setLayoutConstraints(value);
        return component;
    }
}
